﻿#include "mainwindow.h"
#include "ui_mainwindow.h"
using namespace BusinessLayer;

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->voltageWarning->setVisible(false);
    timer.setInterval(100);

    connect(&timer, &QTimer::timeout, this, &MainWindow::on_timer);
    connect(&(*voltage), &Service::Error, this, &MainWindow::on_error);
    connect(&(*voltage), &Service::DataChanged, this, &MainWindow::dataChanged);

    connect(&(*fuelFiller), &Service::DataChanged, this, &MainWindow::on_data_changed_fuel_filler);

    timer.start();
}

MainWindow::~MainWindow()
{
    timer.stop();
//    BusinessLayer::ContainerForDevice::instance.getDataPool()
//        ->UnregisterDataCallback("voltage.voltage");
    delete ui;
}

